﻿using Domain.Entities;
using JFnetcore.Models.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace JFnetcore.CS
{
    public class vLogHelp
    {
        public List<vLog> GetVLogList(List<Log> Loglist, List<User> Userlist)
        {
            var vlist = from a in Loglist 
                        join c in Userlist
                        on a.Log_userid equals c.Id.ToString()
                        select new
                        {
                            Createtime=a.Createtime,
                            Log_ip=a.Log_ip,
                            Log_userid=a.Log_userid,
                            Log_username=c.User_name,
                            Log_operation=a.Log_operation,
                            Log_remark=a.Log_remark
                        };
            return vlist.ToList().Select(C => new vLog
            {
                Createtime = C.Createtime,
                Log_ip = C.Log_ip,
                Log_userid = C.Log_userid,
                Log_username = C.Log_username,
                Log_operation = C.Log_operation,
                Log_remark = C.Log_remark
            }).ToList();
        }
    }
}
